<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改评论')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-comment-edit" th:object="${shopMemberComment}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="memberId" th:value="*{memberId}" class="form-control" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品：</label>
                <div class="col-sm-8">
                    <input name="goodsId" th:value="${shopMemberComment.goods.name}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">会员：</label>
                <div class="col-sm-8">
                    <input name="memberName" th:value="${nickName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">评分：</label>
                <div class="col-sm-8">
                    <input name="source" th:field="*{source}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">评论状态：</label>
                <div class="col-sm-3">
                    <label class="toggle-switch switch-solid">
                        <input type="checkbox" id="status" th:checked="${shopMemberComment.status + '' eq '1' ? true : false}">
                        <span></span>
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="content" th:field="*{content}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "normal/comment";
        $("#form-comment-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var status = $("input[id='status']").is(':checked') == true ? 1 : 0;
                var data = $.param({'status': status}) + '&' +
                    $('#form-comment-edit').serialize();
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</body>
</html>